#!/usr/bin/env python
# -*- coding: utf-8 -*-

from elasticsearch import Elasticsearch

import os

# 加载环境变量
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv()) # 读取本地 .env 文件，里面定义了 ELASTICSEARCH_BASE_URL

print(os.getenv("ELASTICSEARCH_BASE_URL"))

client = Elasticsearch(
  os.getenv("ELASTICSEARCH_BASE_URL"),
  api_key=os.getenv("ELASTICSEARCH_API_KEY")
)

client.info()